Page({
  data: {
    list: [
      {
        id: 'view',
        name: '紧急电话',
        open: false,
        subName: ['医务室', '温泉医院', '院内报警', '温泉派出所'],
        phone: ['71787800', '87831320', '61787891', '87838256']
      }, {
        id: 'form',
        name: '校内交通',
        open: false,
        subName: ['南方叔叔', '南方阿姨', '南方哥哥', '从化汽车站'],
        phone: ['13527758146', '13539842533', '66668', '87990999']
      }, {
        id: 'feedback',
        name: '综合服务',
        open: false,
        subName: ['宿舍报修', 'PC服务队', '网络与实验中心','学院收发室', '行政楼值班室', '校园服务中心'],
        phone: ['61787234', '13640734385', '61787586', '61787301', '61787300', '13802401107']
      }, {
        id: 'nav',
        name: '学院部门',
        open: false,
        subName: ['学院办公电话(A1-304)', '校园管理工作部(A1-106)', '教务部(A1-202)', '基建部(A1-112)', '财务部(A1-321)', '学生工作部(A1-109)', '学院团委(A1-103)', '招生办公室(A1-105)', '就业指导中心(A2-102A)', '心理健康与咨询中心', '体育教育中心(A1-211)', '思政通识教学部(A1-219)', '大英中心(A1-221)', '网络实验中心(图书馆二楼B201)'],
        phone: ['61787368', '61787307', '61787310', '61787361', '61787830', '61787336', '61787007', '61787326', '61787340', '61787708', '61787346', '61787355', '61787381', '61787586']
      }, {
        id: 'map',
        name: '系办公室',
        subName: ['会计学系', '工管系', '电软系', '文传系', '外文系', '公管系', '经管系', '艺创系', '音乐系', '健康与护理系', '政商研究院(10-103)'],
        phone: ['61787330', '61787329', '61787316', '61787352', '61787321', '61787344', '61787334', '61787334', '61787818', '61787398', '61787455']
      },{
        id: 'media',
        name: '食堂服务',
        open: false,
        subName: ['第一食堂', '第二食堂', '第三食堂', '第四食堂', '第五食堂', '第六食堂'],
        phone: ['61787728', '61787730', '13922378282', '13924138555', '13760890338', '18023111908']
      },  {
        id: 'canvas',
        name: '后门公寓',
        subName: ['中大南方招待所（西区）', '东南公寓（保利酒店附近）', '心逸公寓（乌土村老虎形）', '梦公寓（后门）', '城乡公寓（后门）', '乡村公寓', '幸福公寓', '大自然公寓', '大学生公寓', '华景公寓', '心逸公寓', '中南学生公寓', '天星公寓', '鸣汇公寓', '林苑公寓'],
        phone: ['61787222', '13688899235', '657711', '666929', '668743', '18820130338', '13794302699', '658437', '13725349235', '13533892118', '13538787711', '660260', '13798093730', '15817146669', '13926115020']
      }
    ]
  },
  widgetsToggle: function (e) {
    var id = e.currentTarget.id, list = this.data.list;
    for (var i = 0, len = list.length; i < len; ++i) {
      if (list[i].id == id) {
        list[i].open = !list[i].open;
      } else {
        list[i].open = false;
      }
    }
    this.setData({
      list: list
    });
  },
  callPhone: function (e) {
    wx.makePhoneCall({
      phoneNumber: e.target.dataset.phone
    })
  },
  onShareAppMessage: function (event) {
    return {
      title: '校园通讯录',
    }
  }

});
